<template>
  <div v-loading="loading">
    <div style="width: 80px;height: 30px;">
      <input type="checkbox" v-model="checkedAll" @change="checkAll" style="width: 20px;height: 20px;float: left;opacity: 1;">
      <span style="float: right;margin-left: 20px;margin-top: -5px;font-size: 20px;">全选</span>
      <!-- <img class="checked" v-if="!checkedAll" src="../../assets/image/unchecked.png" alt="" style="margin-left: -20px;float: left;"> -->
      <!-- <img class="checked" v-if="checkedAll" src="../../assets/image/checked_01.png" alt="" style="margin-left: -20px;float: left;"> -->
    </div>
    <!-- <div v-for="(item,index) in prolist.slice((currentPage-1)*pagesize,currentPage*pagesize)" :key="index" style="width: 80%;margin-top: 35px;padding: 5px;background: #e5f6fd;"> -->
    <!-- <div v-for="(item,index) in prolist" :key="index" :class="item.getHour == false ? 'deliveryBackground':'deliveryBackground'" style="width: 80%;margin-top: 35px;padding: 5px;"> -->
    <div v-for="(item,index) in prolist" :key="index" style="width: 80%;margin-top: 35px;padding: 5px;">
      <div v-for="(detail,key) in item.orderDetailVOS" :key="key" style="display: flex;" :class="detail.printingTimes > 0 ? 'deliveryBackground':'deliveryStartTime'">
        <div sytle="padding-top: 10px;padding-left: 5px;">
          <!-- <img class="checked" v-if="!detail.checked" src="../../assets/image/unchecked.png" alt="" style="float: left;"> -->
          <!-- <img class="checked" v-if="detail.checked" src="../../assets/image/checked_01.png" alt="" style="float: left;"> -->
          <input type="checkbox"
            v-model="detail.checked"
            :data-warehouseId="item.warehouseId"
            @change="handleCheck(detaillist,detail,key,item,$event)"
            style="width: 20px;height: 20px;float: left;opacity: 1;"
          />
        </div>
        <el-col style="display: flex;flex-direction: column;">
          <el-col style="display: flex;position: relative">
            <div ref="print" style="width: 75%;margin-left: 20px;">
              <h2>{{ detail.goodsName }}</h2>
              <h2 v-if="(detail.num > 1 ? true : false) && (detail.goodsTypeName == '蛋糕' ? true : false)" style="color: red;">数量：{{ detail.num }}个</h2>
              <h3>规格：{{ detail.goodsSpecs }}</h3>
              <p>
                <span>配送时间：{{ item.deliveryStartTime.slice(5,16) }}~{{ item.deliveryEndTime.slice(11,16) }}</span>
                <span style="margin-left: 45px;">下单时间：{{ item.orderTime.slice(5,25) }}</span>
                <span style="margin-left: 45px;">分仓：{{ item.branchWarehouse }}</span>
              </p>
              <!-- <p>分仓：{{ item.branchWarehouse }}</p> -->
              <p>祝福语：{{ detail.blessings }}</p>
              <p style="font-size: 18px;font-weight: 800;margin: 0;">生产需求：<span style="color: red;">{{ item.productionNotes }}</span></p>
              <p>后台单号：{{ item.xmbzNo }}</p>
              <p>平台单号：{{ item.platformOrderId }}</p>
              <p>蛋糕编码：{{ detail.id }}</p>
            </div>
            <span v-if="item.refundMark === '平台退款中' ? true : false" class="timecolor">平台退款中</span>
            <div style="display: flex;justify-content: space-around;width: 28%;align-items: center;">
              <span>
                <el-button type="primary" :data-id="detail.orderId" :data-orderDetailId="detail.id" v-if="detail.productionState==2?true:false" size="small" @click="startProdution($event)" class="production-button production-kindbutton">开始生产</el-button>
                <el-button type="primary" :data-id="detail.orderId" :data-orderDetailId="detail.id" v-if="detail.productionState==3?true:false" size="small" @click="putInStorage($event)" class="production-button production-kindbutton">入库</el-button>
                <!-- <el-button type="primary" v-print="'#print'" :data-orderDetailId="detail.id" size="small" v-if="detail.productionState==2 || detail.productionState==3?true:false" class="production-button" @click="StampStorage($event)">打印</el-button> -->
                <el-button type="primary" :data-id="item.xmbzNo" :data-orderDetailId="detail.id" :data-status="detail.productionState" :disabled="StampStoragebtn == true?true:false" size="small" v-if="detail.productionState==3 || detail.productionState==4 ? true:false" class="production-button production-kindbutton" @click="StampStorage($event)">
                  打印
                  <span v-if="detail.printingTimes !== undefined && detail.printingTimes !== 0 && detail.printingTimes !== '' && detail.printingTimes <= 99">
                    ：{{ detail.printingTimes }}次
                  </span>
                  <span v-if="detail.printingTimes !== undefined && detail.printingTimes !== 0 && detail.printingTimes !== '' && detail.printingTimes > 99">
                    ：99+次
                  </span>
                </el-button>
              </span>
              <span>
                <el-button type="primary" :data-id="item.xmbzNo" :data-goodsSkuProduction="JSON.stringify(detail.goodsSkuProduction)" :data-orderId="detail.orderId" :data-status="detail.productionState" :disabled="Ingredientsbtn == true?true:false" size="small" v-if="detail.productionState==3 || detail.productionState==4 ? true:false" class="production-button production-kindbutton" @click="GetIngredients($event)">
                  打印配料表
                </el-button>
              </span>
              <!-- <el-button type="primary" @click="preview" size="small">打印预览</el-button> -->
            </div>
            <div class="production-status">{{ detail.productionStateName }}</div>
          </el-col>
          <el-col :span="22" :class="detail.printingTimes > 0  ? 'deliveryBackground':'deliveryStartTime'" style="margin-left: 20px;">
            <div @click="changeContent($event,index)" style="display: flex;justify-content: space-between;color: #3a8ee6;font-weight: 600">
              生产详情
              <!-- <h3 style="color: #3a8ee6;margin: 0;line-height: 2;font-size: 18px;">生产详情</h3> -->
              <span class="arrow"></span>
            </div>
            <div v-show="(index == showIndex) && ((clickNumber % 2) == 1 ) ? true : false" :class="detail.printingTimes > 0 ? 'deliveryBackground':'deliveryStartTime'" style="display: flex;justify-content: space-between;margin-right: 35px;font-size: 15px;">
              <span>制作人：{{ detail.producer }}</span>
              <span>裱花人：{{ detail.carver }}</span>
              <span>打包人：{{ detail.packer }}</span>
            </div>
          </el-col>
          <div style="width: 760px;margin-left: 18px;border-bottom: 1px dashed #cecece;"></div>
          <!-- 底边框：#aaaaaa 加急单： #fef4e9  普通单: #e5f6fd 生产中详情：#6a6b6b-->
          <div>
          </div>
        </el-col>
      </div>
    </div>
    <div style="position: fixed;top: -100%;right: -100%;">
      <Printform v-if="labelcheckedFlag == false ? true : false" ref="Printform" id="PrintProduction" v-bind:orderGoodriesList="StampStorageReturnList" v-bind:orderId="StampStorageReturnList" style="width: 350px;height: 150px;"></Printform>
      <LabelPrint v-if="labelcheckedFlag == true ? true : false" ref="Printform" id="PrintProduction" v-bind:orderGoodriesList="StampStorageReturnList" v-bind:orderId="StampStorageReturnList" style="width: 350px;height: 150px;"></LabelPrint>
      <CookieTemplate ref="CookieTemplate" id="CookieTemplate" v-bind:CookieTemplateList="CookieTemplateList" style="width: 350px;height: 150px;"></CookieTemplate>
    </div>
    <el-pagination
      background
      :current-page.sync="currentPage"
      layout="prev, pager, next, sizes, total, jumper"
      :page-sizes="[5, 10, 15, 20]"
      :page-size.sync="pagesize"
      :total="prolisttotal"
      @current-change="handleCurrentChange"
      @size-change="handleSizeChange"
      style="margin-bottom: 30px;"
    >
    </el-pagination>
    <el-dialog :visible.sync="productionFlag" center :append-to-body="true" :lock-scroll="false" width="40%" z-index="2007">
      <div style="width: 100%;height: 350px;">
        <el-scrollbar class="page-component__scroll" style="height: 400px;">
          <div v-if="productionStartFlag">
            <el-col style="margin-top: 1%;">
              <div class="order-message" style="height: 35px;">
                <el-col style="padding-left: 5px;font-size: 20px;">
                  开始生产
                </el-col>
              </div>
              <div style="height: 300px;margin-left: 25px;">
                <el-form :model="startruleForm" :rules="startrules" ref="startruleForm" label-width="100px" class="demo-ruleForm">
                  <el-form-item label="制作人" prop="producer">
                    <el-input
                      v-model="startruleForm.producer"
                      placeholder="请输入制作人"
                      maxlength="10"
                      style="width: 300px;"
                    ></el-input>
                    <!-- <el-select v-model="startruleForm.producer" placeholder="请输入制作人">
                      <el-option
                        v-for="(item,index) in returnOrderReasonList"
                        :key="index"
                        :label="item.dictValue"
                        :value="item.dictKey"
                      >
                      </el-option>
                    </el-select> -->
                  </el-form-item>
                  <el-form-item label="裱花人" prop="carver">
                    <el-input
                      v-model="startruleForm.carver"
                      placeholder="请输入裱花人"
                      maxlength="10"
                      style="width: 300px;"
                    ></el-input>
                    <!-- <el-select v-model="startruleForm.carver" placeholder="请输入裱花人">
                      <el-option
                        v-for="(item,index) in whetherProduceList"
                        :key="index"
                        :label="item.dictValue"
                        :value="item.dictKey"
                      >
                      </el-option>
                    </el-select> -->
                  </el-form-item>
                  <el-form-item label="打包人" prop="packer">
                    <el-input
                      v-model="startruleForm.packer"
                      placeholder="请输入打包人"
                      maxlength="10"
                      style="width: 300px;"
                    ></el-input>
                    <!-- <el-select v-model="startruleForm.packer" placeholder="请输入打包人">
                      <el-option
                        v-for="(item,index) in cakeWhereaboutsList"
                        :key="index"
                        :label="item.dictValue"
                        :value="item.dictKey"
                      >
                      </el-option>
                    </el-select> -->
                  </el-form-item>
                  <el-form-item>
                    <el-button @click="startResetForm('startruleForm')">取消</el-button>
                    <el-button type="primary" @click="startSubmitForm('startruleForm')">确定</el-button>
                  </el-form-item>
                </el-form>
              </div>
            </el-col>
          </div>
        </el-scrollbar>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="StorageStartFlag" center :append-to-body="true" :lock-scroll="false" width="30%" z-index="2007">
      <div style="width: 100%;height: 100px;">
        <div style="width: 100%;">
          <el-form :model="StorageruleForm" ref="StorageruleForm" label-width="100px" class="demo-ruleForm">
            <div style="font-size: 17px;margin-left: 5px;">
              是否执行入库操作？
            </div>
            <el-form-item style="margin-top: 7%;display: flex;justify-content: flex-end;">
              <el-button @click="StorageResetForm()">取消</el-button>
              <el-button type="primary" @click="StorageSubmitForm('StorageruleForm')">确定</el-button>
            </el-form-item>
          </el-form>
        </div>
      </div>
    </el-dialog>
    <el-dialog :visible.sync="IngredientsFlag" :close-on-click-modal="false" center :append-to-body="true" :lock-scroll="false" width="50%" z-index="2007">
      <div style="width: 100%;height: 300px;">
        <div style="width: 100%;">
          <el-form :model="IngredientsForm" ref="IngredientsForm" :rules="Ingredientsrules" label-width="100px" class="demo-ruleForm">
            <div style="font-size: 17px;margin-left: 5px;margin-bottom: 50px;">
              上传配料表
            </div>
            <el-form-item label="搜索蛋糕" style="margin-left: 30px;" prop="Ingredientgoods">
              <el-cascader
                ref="cascaderRef"
                :key="isResouceShow"
                v-model="IngredientsForm.Ingredientgoods"
                placeholder="蛋糕"
                :options="GoodsByNameList.length > 0 ? GoodsByNameList : GoodsByNameLists"
                :props="{ expandTrigger: 'hover' }"
                @input.native="getName($event)"
                @change="handleChange"
                filterable
              ></el-cascader>
            </el-form-item>
            <el-form-item style="display: flex;justify-content: space-around;margin-top: 130px;margin-right: 70px;">
              <el-button @click="IngredientsResetForm('IngredientsForm')" style="margin-right: 50px;">取消</el-button>
              <el-button type="primary" @click="IngredientsSubmitForm('IngredientsForm')">确定</el-button>
            </el-form-item>
          </el-form>
        </div>
      </div>
    </el-dialog>
    <!-- 打印 -->
  </div>
</template>
<script language="javascript" type="text/javascript" src="../lodop/LodopFuncs.js"></script>

<script>
// import {
//   citySelect,
// } from "@/api/createOrder";
import Printform from "@/components/Printform"; // 打印蛋糕模板
import LabelPrint from "@/components/Printform/labelprint"; // 打印蛋糕模板
// import Pagination from "@/components/Pagination"; // 分页
// import Print from '@/plugs/print.js';
// Vue.use(Print); // 注册
import getLodop from '@/lodop/LodopFuncs';
import { query } from "@/api/user"; // 查询生产打印机设备
// import vueEasyPrint from "vue-easy-print";
import {
  singleStartProduction, //开始生产
  getProductionQueryPage, //查询列表
  orderWarehousing, // 入库和批量入库
  orderPrinting, // 打印和批量打印
  orderPrintingFrequency,  // 批量打印信息
  confirmAbnormalLog, // 确认入库记录
  addOrderWarehousingLog, // 新增入库记录
  // getOrderWarehousingLogList, // 获取入库记录
  getMaterielGoodsByName,// 根据物料商品名称模糊查询
  getMaterielGoodsPrintingInfo,// 搜索出物料商品,打印需要返回的信息
} from '@/api/shop'
import CookieTemplate from "@/components/Cookie-template"; // 打印曲奇模板
export default {
  // components: { Printform,vueEasyPrint },
  components: { Printform, LabelPrint, CookieTemplate },
  props: {
    getProductionQueryPageList: {
      required: true
    },
    submitForm: {
      type: Function,
      default: null
    },
    productionQuery: {
      required: true
    },
    isQueryFlag: {
      required: true
    },
    labelcheckedFlag: {
      required: false
    }
  },
  data() {
    var validatePass = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入制作人'));
      } else {
        this.startruleForm.producer = value.replace(/\s+/g, '');
        callback();
      }
    };
    var validatePass1 = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入裱花人'));
      } else {
        this.startruleForm.carver = value.replace(/\s+/g, '');
        callback();
      }
    };
    var validatePass2 = (rule, value, callback) => {
      if (value === '') {
        callback(new Error('请输入打包人'));
      } else {
        this.startruleForm.packer = value.replace(/\s+/g, '');
        callback();
      }
    };
    return {
      prolisttotal: 0,
      total: 0,
      pagesize: 10,
      currentPage: 1,
      checkedAll: false,
      checkedCities: [],
      isIndeterminate: true,
      checkedCount: [],
      prolist: '',
      prolistCopy: this.getProductionQueryPageList,
      productionFlag: false, // 开始生产弹窗Flag
      productionStartFlag: false, // 开始生产按钮请求列表弹窗显示Flag
      StorageStartFlag: false, // 入库按钮请求列表弹窗显示Flag
      startruleForm: { // 开始生产
        orderId: 2, // 后台单号
        orderDetailId: 2, // 订单明细id
        producer: '', // 制作人
        carver: '', // 裱花人
        packer: '', // 打包人
      },
      startrules: {
        producer: [
          {
            required: true,
            validator: validatePass,
            trigger: 'change'
          }
        ],
        carver: [
          { required: true,
            validator: validatePass1,
            // message: '请输入裱花人',
            trigger: 'change'
          }
        ],
        packer: [
          { required: true,
            validator: validatePass2,
            // message: '请输入打包人',
            trigger: 'change'
          }
        ]
      },
      StorageruleForm: { // 入库
        orderId: 132,
        orderDetailId: 132
      },
      // StorageRecordStartFlag: false, // 入库成功与否弹框
      StorageRecordList: [], // 获取入库记录列表
      detaillist: [],
      orderGoodriesList: '', //选中商品列表
      cityLi: {
        roleId: 1
      },
      singleStartProductionQuery: { // 开始生产请求列表
      },
      StampStorageList: [], // 打印列表
      loading: false, // loading加载
      StampStorageReturnList: '', //打印返回列表
      confirmAbnormalLogList: '', // 确认入库请求列表
      addOrderWarehousingLog: { // 新增入库记录列表
        orderId: 123,
        orderDetailId: 132,
        warehousingState: 0
      },
      // StorageRecordList: [], // 获取入库记录请求列表
      StorageRecordAbnormalList: '', // 获取入库记录正常、异常数量
      WarehousingLogStatus: [], // 扫描入库前的状态
      elMain: {
       'background': 'oldlace'
      },
      showIndex: '', // 折叠面板索引
      clickNumber: '', // 折叠面板点击次数
      clickOrder: '', // 折叠面板当前点击的订单
      StampStoragebtn: false,
      mainWarehouseNames:'全部',
      CookieTemplateList: [],// 配料表
      IngredientsFlag: false,// 配料表是否上传弹框
      IngredientsForm: {
        deptId: this.deptId,
        Ingredientgoods: [],
        name: '',
        page: 1,
        size: 10,
      },
      Ingredientsrules: {
        Ingredientgoods: [{ required: true, message: '请选择蛋糕', trigger: 'change' }]
      },
      GoodsByNameList: [],
      GoodsByNameLists: [{
        value: '111',
        label: '无匹配数据',
        disabled: true
      }],
      Ingredientsbtn: false,// 打印物料表按钮disabled
      isResouceShow: 1,
      cascaderFlag: false,
    };
  },
  mounted() {
    let code = "";
    let lastTime, nextTime
    let lastCode, nextCode
    let that = this
    window.document.onkeypress = function (e) {
      if (window.event) { // IE
        nextCode = e.keyCode
      } else if (e.which) { // Netscape/Firefox/Opera
        nextCode = e.which
      }
      if (e.which === 13) {
        if (code.length < 3) return // 手动输入的时间不会让code的长度大于2，所以这里只会对扫码枪有
        that.parseCode(code) // 获取到扫码枪输入的内容，做别的操作
        code = ''
        lastCode = ''
        lastTime = ''
        return
      }
      nextTime = new Date().getTime()
      if (!lastTime && !lastCode) {
        // console.log('扫码开始。。。')
        code += e.key
      }
      if (lastCode && lastTime && nextTime - lastTime > 500) { // 当扫码前有keypress事件时,防止首字缺失
        // console.log('防止首字缺失。。。')
        code = e.key
      } else if (lastCode && lastTime) {
        // console.log('扫码中。。。')
        code += e.key
      }
      lastCode = nextCode
      lastTime = nextTime
    }
    // 城市
    // citySelect(this.cityLi).then(res => {
    //   this.listProp.deptId = res.data.data[0].id;
    // }),
    setTimeout(() => {
      this.cityId = JSON.parse(window.localStorage.getItem("saber-areaId")).content
      this.getList()
    },800)
  },
  watch: {
    getProductionQueryPageList(newVal){
      // console.log('121321')
      this.prolisttotal = newVal.total
      this.prolist = newVal.rows
      const details = []
      this.prolist.forEach(itemorder => {
        itemorder.getHour = this.getHour(itemorder.deliveryEndTime).toFixed(2);
        // console.log(itemorder.getHour,'itemorder.getHour')
        if (itemorder.getHour > 3) {
          // console.log(itemorder.getHour, '>3')
          itemorder.getHour = true
        } else if (itemorder.getHour < 3) {
          // console.log(itemorder.getHour,'<3') // data00000
          itemorder.getHour = false
        } else if (itemorder.getHour.toString() === 'NaN') {
          // console.log('/3')
          itemorder.getHour = true
        }
        itemorder.orderDetailVOS.forEach(item => {
          item.warehouseId = itemorder.warehouseId
          this.$set(item, "checked", false)
          details.push(item)
        })
      })
      this.detaillist = details;
      this.checkedAll = false;
      this.checkedAllFlag = false;
      
      // console.log('this.checkedAllFlag',this.checkedAllFlag)
    },
    'IngredientsFlag'() {
      if(!this.IngredientsFlag) {
        this.cascaderFlag = true;
        this.GoodsByNameList = [];// 配料表搜索数据列表清空
        this.CookieTemplateList = '';// 打印数据
      }
    }
  },
  methods: {
    // 计算时间差
    getNowTime() {
      let nowYear = new Date().getFullYear()
      let nowMonth = (new Date().getMonth() + 1) < 10? "0" + (new Date().getMonth() + 1) : (new Date().getMonth() + 1);
      let nowDate = new Date().getDate() < 10? "0" + new Date().getDate() : new Date().getDate();
      // let nowHours = new Date().getHours() < 10? "0" + new Date().getHours() : new Date().getHours();
      // let nowMinutes = new Date().getMinutes() < 10? "0" + new Date().getMinutes() : new Date().getMinutes();
      // console.log(e.currentTarget.dataset.time,nowYear + '-' + nowMonth + '-' + nowDate + ' ' + nowHours + ':' + nowMinutes)
      let nowTime = nowYear + '-' + nowMonth + '-' + nowDate + ' '
      // console.log('nowTime',nowTime,'nowTime')
      return nowTime
    },
    // getProductionQueryList() {
    //   this.loading = true;
    //  const productionQuery = { // 备款退订请求参数
    //    deptId: this.cityId,
    //    xmbzNo: this.productionQuery.xmbzNo,
    //    // mainWarehouse: this.productionQuery.mainWarehouse,
    //    mainWarehouse: this.mainWarehouseNames == '全部' ? '' : this.mainWarehouseNames,
    //    warehouseId: this.productionQuery.warehouseId,
    //    status: this.productionQuery.status,
    //    deliveryStartTime: this.productionQuery.deliveryStartTime,
    //    deliveryEndTime: this.productionQuery.deliveryEndTime,
    //    goodsName: this.productionQuery.goodsName,
    //    goodsSpecs: this.productionQuery.goodsSpecs,
    //  }
    //   getProductionQueryPage(productionQuery).then(res => {
    //     this.prolisttotal = res.data.data.total;
    //     this.prolist = res.data.data.rows;
    //     this.loading = false;
    //   })
    //   this.detaillist = [];
    //   const details = [];
    //   this.prolist.forEach(itemorder => {
    //     itemorder.getHour = this.getHour(itemorder.deliveryEndTime).toFixed(2);
    //     // console.log(itemorder.getHour,'itemorder.getHour')
    //     if (itemorder.getHour > 3) {
    //       // console.log(itemorder.getHour, '>3')
    //       itemorder.getHour = true
    //     } else if (itemorder.getHour < 3) {
    //       // console.log(itemorder.getHour,'<3') // data00000
    //       itemorder.getHour = false
    //     } else if (itemorder.getHour.toString() === 'NaN') {
    //       // console.log('/3')
    //       itemorder.getHour = true
    //     }
    //     itemorder.orderDetailVOS.forEach(item => {
    //       item.warehouseId = itemorder.warehouseId;
    //       this.$set(item, "checked", false);
    //       details.push(item);
    //     })
    //   })
    //   // console.log('details',details)
    //   this.checkedCount = [];
    //   this.detaillist = details;
    //   this.checkedAll = false;
    //   this.checkedAllFlag = false;
    // },
    getList() {
      // this.loading = true;
      this.detaillist = [];
      this.productionQuery.deptId = this.cityId;
      if(this.productionQuery.mainWarehouse=='全部'){
        this.productionQuery.mainWarehouse=''
        this.mainWarehouseNames='';
      }

      getProductionQueryPage(this.productionQuery).then(res => {
        // console.log('this.total',res.data.data.total);
        this.prolisttotal = res.data.data.total;
        this.prolist = res.data.data.rows;
        // console.log('itemorder',this.prolist)
        const details = []
        this.prolist.forEach(itemorder => {
          itemorder.getHour = this.getHour(itemorder.deliveryEndTime).toFixed(2);
          // console.log(itemorder.getHour,'itemorder.getHour')
          if (itemorder.getHour > 3) {
            // console.log(itemorder.getHour, '>3')
            itemorder.getHour = true
          } else if (itemorder.getHour < 3) {
            // console.log(itemorder.getHour,'<3') // data00000
            itemorder.getHour = false
          } else if (itemorder.getHour.toString() === 'NaN') {
            // console.log('/3')
            itemorder.getHour = true
          }
          itemorder.orderDetailVOS.forEach(item => {
            // console.log('itemorder',itemorder)
            item.warehouseId = itemorder.warehouseId
            this.$set(item, "checked", false)
            details.push(item)
          })
        })
        this.checkedCount = []
        this.detaillist = details
        // this.loading = false
        this.checkedAll = false
        this.checkedAllFlag = false;
        if((this.productionQuery.status == 2 || this.productionQuery.status == 3) && this.prolist.length == 0 && this.productionQuery.page > 1) {
          this.productionQuery.page = this.currentPage = this.productionQuery.page - 1;
          if(this.productionQuery.mainWarehouse==''){
            this.productionQuery.mainWarehouse='全部'
            this.mainWarehouseNames='';
          }
          this.getList();
        }
      })
    },
    // 计算时间差
    getHour(endTime) {
      let nowYear = new Date().getFullYear();
      let nowMonth = (new Date().getMonth() + 1) < 10 ? "0" + (new Date().getMonth() + 1) : (new Date().getMonth() +
        1);
      let nowDate = new Date().getDate() < 10 ? "0" + new Date().getDate() : new Date().getDate();
      let nowHours = new Date().getHours() < 10 ? "0" + new Date().getHours() : new Date().getHours();
      let nowMinutes = new Date().getMinutes() < 10 ? "0" + new Date().getMinutes() : new Date().getMinutes();
      // console.log(e.currentTarget.dataset.time,nowYear + '-' + nowMonth + '-' + nowDate + ' ' + nowHours + ':' + nowMinutes)
      let nowTime = nowYear + '-' + nowMonth + '-' + nowDate + ' ' + nowHours + ':' + nowMinutes
      let s1 = new Date(endTime.replace(/-/g, '/'));
      // console.log('s1',s1)
      let s2 = new Date(nowTime.replace(/-/g, '/'));
      let ms = Math.abs(s1.getTime() - s2.getTime());
      let getHour = ms / 1000 / 60 / 60;
      // console.log('getHour',getHour)
      return getHour
    },
    // 初始页currentPage、初始每页数据数pagesize和数据data
    handleSizeChange: function (size) {
      this.pagesize = size;
      this.productionQuery.page = this.currentPage
      this.productionQuery.size = this.pagesize
      this.querySizePage()
    },
    // 跳转currentPage 02
    handleCurrentChange: function(currentPage) {
      this.productionQuery.page = currentPage
      this.currentPage = currentPage
      this.productionQuery.size = this.pagesize
      this.querySizePage()
      document.body.scrollTop = document.documentElement.scrollTop = 0;
    },
    // 分页改变或者条数改变时请求数据
    querySizePage() {
      if(this.productionQuery.mainWarehouse=='全部'){
        this.productionQuery.mainWarehouse=''
        this.mainWarehouseNames='';
      }
      getProductionQueryPage(this.productionQuery).then(res => {
        this.prolisttotal = res.data.data.total;
        this.prolist = res.data.data.rows;
        // console.log('prolist',this.prolist);
        this.detaillist = []
        // console.log('this.prolist',this.prolist)
        this.checkedAll = false
        this.checkedCount = []
        const details = []
        this.prolist.forEach(itemorder => {
          itemorder.getHour = this.getHour(itemorder.deliveryEndTime).toFixed(2);
          // console.log(itemorder.getHour,'itemorder.getHour')
          if (itemorder.getHour > 3) {
            // console.log(itemorder.getHour, '>3')
            itemorder.getHour = true
          } else if (itemorder.getHour < 3) {
            // console.log(itemorder.getHour,'<3') // data00000
            itemorder.getHour = false
          } else if (itemorder.getHour.toString() === 'NaN') {
            // console.log('/3')
            itemorder.getHour = true
          }
          // console.log('this.prolist',this.prolist)
          itemorder.orderDetailVOS.forEach(item => {
            // console.log(itemorder.warehousingState)
            item.warehouseId = itemorder.warehouseId
            this.$set(item, "checked", false)
            details.push(item)
          })
        })
        // console.log('this.prolist',this.prolist,details)
        this.detaillist = details
        if(this.productionQuery.mainWarehouse==''){
          this.productionQuery.mainWarehouse='全部'
          this.mainWarehouseNames='';
        }
      })
    },
    //全选
    checkAll() {
      const details = [];
      this.prolist.forEach(itemorder => {
        // console.log('this.prolist',this.prolist)
        itemorder.orderDetailVOS.forEach(item => {
          item.checked = this.checkedAll
          details.push(item)
        })
      })
      this.detaillist = details
      this.orderGoodriesList = this.detaillist
      this.checkedAllFlag = true;
    },
    handleCheck(detaillist,detail,key,item,e) { //反选
      // console.log('detail',detail.checked)
      // detail.key = detail.orderId + key;
      var check = [];
      this.detaillist.forEach(item => {
        if(detail.id == item.id) item.checked = item.checked;
        check.push(item.checked);
      })
      let checkedCountList = [];
      let orderGoodsList = [];
      // detail.warehouseId = e.currentTarget.dataset.warehouseid;
      // this.checkedCount.push(detail);
      // this.checkedCount.forEach((item,index) => {
      //   if(this.checkedCount[index].checked == true) {
      //     checkedCountList.push(this.checkedCount[index]);
      //   }
      // })
      detaillist.forEach((detailitem,detailindex) => {
        detailitem.key = detail.orderId + key;
        if(detaillist[detailindex].checked == true) {
          checkedCountList.push(detaillist[detailindex]);
        }
      })
      orderGoodsList = checkedCountList;
      // orderGoodsList = this.unique(checkedCountList);
      this.orderGoodriesList = orderGoodsList;
      // console.log(orderGoodsList,this.orderGoodriesList,'反选')
      if (check.indexOf(false) == -1) {
        // console.log()
        this.checkedAll = true;
      } else {
        this.checkedAll = false;
      }
      this.checkedAllFlag = true;
    },
    unique(arr) {
      const res = new Map();
      return arr.filter((arr) => !res.has(arr.key) && res.set(arr.key, 1));
    },
    getMessage() {
      // this.getList()2296149763312640
      // console.log('this.checkedCount',this.orderGoodriesList)
      return this.orderGoodriesList
    },
    startProdution(e) { // 开始生产 02
      // console.log(e.currentTarget.dataset)
      this.startruleForm.orderId = e.currentTarget.dataset.id
      this.startruleForm.orderDetailId = e.currentTarget.dataset.orderdetailid
      this.startruleForm.producer = '未填写' // 制作人
      this.startruleForm.carver = '未填写' // 裱花人
      this.startruleForm.packer = '未填写' // 打包人
      singleStartProduction(this.startruleForm).then(res => {
        if(res.data.code == 200) {
          this.$notify({
            title: '生产成功',
            message: '请您耐心等待',
            type: 'success'
          })
          this.$emit('getProductionNumber')
          // this.checkAll()
          setTimeout(() => {
            this.productionFlag = false
            this.productionStartFlag = false
          }, 1*1000);
          this.getList();
        }
      })
      // this.productionFlag = true
      // this.productionStartFlag = true
    },
    startSubmitForm(formName) {// 开始生产确认按钮
      this.$refs[formName].validate((valid) => {
        if (valid) {
          singleStartProduction(this.startruleForm).then(res => {
            if(res.data.code == 200) {
              this.$notify({
                title: '生产成功',
                message: '请您耐心等待',
                type: 'success'
              })
              this.$refs[formName].resetFields();
              this.$emit('getProductionNumber')
              setTimeout(() => {
                this.productionFlag = false
                this.productionStartFlag = false
              }, 1*1000);
              // this.getProductionQueryList();
              // this.$parent.submitForm()
              // console.log(this.productionQuery,'this.$parent')
            }
          })
        } else {
          return false;
        }
      })
    },
    startResetForm(formName) {// 开始生产取消按钮
      this.$refs[formName].resetFields();
      this.productionFlag = false
      this.productionStartFlag = false
      // this.complainFlag = false;
    },
    putInStorage(e) { // 入库
      this.StorageStartFlag = true
      this.StorageruleForm.orderId = e.currentTarget.dataset.id
      this.StorageruleForm.orderDetailId= e.currentTarget.dataset.orderdetailid
      let Storagelist = []
      Storagelist.push(Number(e.currentTarget.dataset.orderdetailid))
      this.StorageRecordList = Storagelist
      // this.StorageruleForm.orderDetailId = Number(e.currentTarget.dataset.orderdetailid)
    },
    StorageSubmitForm(formName) {// 入库确认按钮
      this.$refs[formName].validate((valid) => {
        if (valid) {
          orderWarehousing(this.StorageruleForm).then(res => {
            if(res.data.code == 200) {
              this.$notify({
                title: '入库成功',
                message: '请您耐心等待',
                type: 'success'
              })
              this.$refs[formName].resetFields();
              this.$emit('getProductionNumber')
              this.StorageStartFlag = false;
              // this.getProductionQueryList();
              this.getList();
            }
          })
        } else {
          alert('0000000000000')
          return false;
        }
      });
    },
    StorageResetForm() {// 入库取消按钮
      this.StorageStartFlag = false
    },
    StampStorage(e) { // 打印
      window.localStorage.setItem('proPathFlag',this.$route.path);
      this.StampStoragebtn = true;
      this.WarehousingLogStatus = []
      let statusCode = Number(e.currentTarget.dataset.status)
      if(statusCode == 2 || statusCode == 3) {
        this.WarehousingLogStatus.push(statusCode)
      }
      let _this = this;
      let Stamplist = []
      Stamplist.push(e.currentTarget.dataset.orderdetailid)
      this.StampStorageList = Stamplist;
      let formInline = {
        type: 1,
        key: '[1,2]',
        userId: JSON.parse(window.localStorage.getItem("saber-userInfo")).content.account
      }
      query(formInline).then(res => {
        if(res.data.msg == '执行成功') {
          console.log('res.data.data[0].value',res.data.data.length)
          if(res.data.data.length == 0) {
            this.$message.warning("请到系统模块中的打印机设置中添加打印机");
            this.StampStoragebtn = false;
          } else if (res.data.data.length > 0) {
            res.data.data[0].value = `${res.data.data[0].value}`;
            formInline.value = JSON.parse(res.data.data[0].value);
            formInline.print01 = formInline.value[0];
            formInline.print02 = formInline.value[1];
            console.log(res.data.data[0].value,'000','formInline.value',formInline.print01);
            orderPrinting(this.StampStorageList).then(res => {
              if(res.data.code == 200) {
                // res.data.data.forEach((item,index) => {
                //   res.data.data[index].productionState = '999',
                //   res.data.data[index].item = '999'
                // })
                this.StampStorageReturnList = res.data.data;
                this.getList();
                setTimeout(() => {
                  // console.log(this,'this')
                  const LODOP = getLodop()
                  if (LODOP) {
                    // console.log('res.data.data',res.data.data)
                    var strBodyStyle = '<style>'
                    strBodyStyle += '.tableList table { border-top: 0; border-left: 0; border-collapse:collapse; border-spacing:0;height: 200px;}'
                    // strBodyStyle += 'caption { line-height:2; }'
                    strBodyStyle += 'td { border-right: 0;width: 130px; border-bottom: 0; padding:2px 3px; font-size:11px;}'
                    strBodyStyle += '</style>' //设置打印样式
                    var strFormHtml = strBodyStyle + '<body>' + document.getElementById('PrintProduction').innerHTML + '</body>' //获取打印内容
                    LODOP.PRINT_INIT('') //初始化
                    // LODOP.SET_PRINTER_INDEX("POSTEK C168/200s",true); // 增加，需删除
                    // LODOP.SET_PRINTER_INDEX("NPI46C2BB (HP LaserJet M1536dnf MFP)"); // 增加，需删除
                    LODOP.SET_PRINT_PAGESIZE(0,'101.3mm','0mm','USER')
                    // LODOP.SET_PRINT_PAGESIZE(2, 0, 0, 'A4') //设置横向
                    LODOP.ADD_PRINT_HTM('1%', '1%', '98%', '98%', strFormHtml) //设置打印内容
                    // console.log('strFormHtml',strFormHtml)
                    // LODOP.SET_PREVIEW_WINDOW(2, 0, 0, 800, 600, 0) //设置预览窗口模式和大小
                    let printFlag = true;// 判断传参是否有空
                    let printArray = [];// 判断传参是否有空
                    CLODOP.On_Return=function(TaskID,value){
                      var stResult = LODOP.GET_VALUE("PRINT_STATUS_ID",value);
                      var stResultText = LODOP.GET_VALUE("PRINT_STATUS_TEXT",value);
                      // console.log('valuelist',TaskID,value,stResult,stResultText)
                      if(value) {
                        if(_this.StampStorageList.length > 0) {
                          _this.StampStorageList.forEach(item => {
                            if((item == undefined) || (item == '') || (item == null)) printArray.push(false);
                          })
                        } else {
                          printArray.push(false);
                        }
                        if(printArray.indexOf(false) > -1) {
                          printFlag = false;
                          _this.$message.warning('未获取到打印数据，请重新选择');
                          setTimeout(() => {
                            _this.StampStoragebtn = false;
                            _this.getList();
                          },1000);
                        } else {
                          printFlag = true;
                        }
                        if(printFlag) {
                          orderPrintingFrequency(_this.StampStorageList).then(res => {
                            if (res.data.code == 200) {
                              // res.data.data.forEach((resitem, resindex) => {
                              //   res.data.data[resindex].productionState = this.$refs.procedureEdit.WarehousingLogStatus[
                              //     resindex]
                              // })
                              _this.$notify({
                                title: '打印成功',
                                message: '请您耐心等待',
                                type: 'success'
                              })
                              // _this.getProductionQueryList();
                              _this.WarehousingLogStatus = []
                              _this.checkedAll = false;
                              _this.getList();
                            }
                          })
                        }
                      } else {
                        _this.StampStorageList = [];
                        _this.$message.warning('打印失败，请检查是否安装好驱动和已经连接打印机');
                        setTimeout(() => {
                          _this.StampStoragebtn = false;
                          _this.getList();
                        },1000);
                      }
                    }
                    LODOP.SET_PRINT_MODE(formInline.print01,true);//这个语句设置网络共享打印机
                    LODOP.SET_PRINTER_INDEX(formInline.print01,true); // 增加，需删除
                    console.log(LODOP.SET_PRINTER_INDEX(formInline.print01),LODOP.SET_PRINTER_INDEX(formInline.print01,true),'LODOP.SET_PRINTER_INDEX(`${formInline.print01}`)')
                    if(LODOP.SET_PRINTER_INDEX(formInline.print01)) {
                      if(printFlag) {
                        LODOP.PRINT(); // 增加，需删除
                        setTimeout(() => {
                          this.StampStoragebtn = false;
                        },1000);
                      }
                    }
                    // LODOP.PREVIEW()
                    // if(LODOP.SET_PRINTER_INDEX("NPI46C2BB(HP LaserJet M1536dnf MFP)")) LODOP.PRINT(); // 增加，需删除
                    // if(LODOP.SET_PRINTER_INDEX(`${formInline.print01}`)) LODOP.PRINT(); // 增加，需删除
                  }
                }, 1*1000);
              }
            })
          }
        }
      })
    },
    changeContent(e,index) {
      // console.log(this.clickOrder,'index',index,this.prolist[index].xmbzNo)
      if(this.clickOrder === '' || this.clickOrder !== this.prolist[index].xmbzNo) {
        this.clickOrder = this.prolist[index].xmbzNo;
        this.clickNumber = 1;
        // console.log('this.clickOrder',this.clickOrder)
      } else {
        this.clickNumber++;
      }
      if((this.clickNumber % 2)) {
        // e.target.style.transition = 'transform 1s';
        e.target.nextElementSibling.style.transition = 'transform .3s';
        e.target.lastElementChild.style.transition = 'transform 1s';
        e.target.lastElementChild.style.transform = 'rotate(135deg)';
      } else {
        // e.target.style.transition = 'transform 1s';
        e.target.lastElementChild.style.transition = 'transform .3s';
        e.target.lastElementChild.style.transform = 'rotate(45deg)';
      }
      // this.prolist[index].showContent=!this.prolist[index].showContent;
      this.showIndex = index;
      console.log(this.clickNumber % 2)
      // this.showContent=!this.showContent;
    },
    // 创建扫描控件
    parseCode (code) {
      const Numarr = [];
      let Numobj = `${code}`;
      Numobj = JSON.parse(Numobj);
      // console.log('Numobj',Numobj.orderId,Numobj)
      this.StorageruleForm.orderId = Numobj.orderId; // 入库请求参数
      this.StorageruleForm.orderDetailId= Numobj.orderDetailId;  // 入库请求参数
      // 新增入库记录
      this.addOrderWarehousingLog.orderId = Numobj.orderId;
      this.addOrderWarehousingLog.orderDetailId= Numobj.orderDetailId;
      // 获取入库记录请求列表
      let Storagelist = [];
      Storagelist.push(Numobj.orderDetailId);
      this.StorageRecordList = Storagelist;
        // 确认入库请求参数
      Numarr.push(Numobj.orderId,Numobj.orderDetailId);
      this.confirmAbnormalLogList = Numarr; // 确认入库请求参数
      let StatusCode = true;
      if(Numobj.status !== 3) {
        StatusCode = false;
        if(Numobj.status == 2) {
          this.$message({
            type: 'warning',
            message: '蛋糕暂未制作完成!'
          });
        } else if(Numobj.status == 4) {
          this.$message({
            type: 'warning',
            message: '请勿重复入库!'
          });
        } else if(Numobj.status == 9) {
          this.$message({
            type: 'warning',
            message: '蛋糕已改期!'
          });
        } else if(Numobj.status == 10) {
          this.$message({
            type: 'warning',
            message: '蛋糕已退订!'
          });
        }
      }
      if(StatusCode == true) {
        orderWarehousing(this.StorageruleForm).then(res => {
          if(res.data.code == 200) {
            // console.log(' 请求入库')
            this.addOrderWarehousingLog.warehousingState = 1
            // 新增入库记录
            addOrderWarehousingLog(this.addOrderWarehousingLog).then(res => {
            if(res.data.code == 200) {
                // console.log(' 新增入库记录')
                // 获取入库记录
                // getOrderWarehousingLogList("").then(res => {
                //   if(res.data.code == 200) {
                    // console.log(' 获取入库记录')
                    // console.log(res.data.data,'111')
                    // this.StorageRecordStartFlag = false;
                    // this.StorageRecordAbnormalList = res.data.data
                      this.$notify({
                        title: '入库成功',
                        message: '请您耐心等待',
                        type: 'success'
                      });
                      this.$emit('getProductionNumber');
                      this.getList();
                //   }
                // })
              }
            })
          } else if(res.data.code == 301) { // 二维码信息不存在
            this.$notify({
              title: '二维码信息不存在',
              message: '请确认二维码信息',
              type: 'warning'
            });
            this.getList();
          }
        }).catch(err => {
          console.log('err01',err)
        })
      }
    },
    // 打印配料表
    GetIngredients(e) {
      window.localStorage.setItem('proPathFlag',this.$route.path);
      this.Ingredientsbtn = true;
      let goodsSkuProduction = e.currentTarget.dataset.goodsskuproduction;
      this.IngredientsForm.orderId = e.currentTarget.dataset.orderid;//搜索出物料商品,打印需要返回的信息orderId
      // console.log(goodsSkuProduction == '{}',goodsSkuProduction,e.currentTarget.dataset.goodsskuproduction);
      if(goodsSkuProduction == '{}') {
        this.$confirm('该商品尚未上传物料表', '提示', {
          confirmButtonText: '去上传',
          cancelButtonText: '取消',
          type: 'warning',
          center: true,
          closeOnClickModal: false,// 是否可通过点击遮罩关闭
          showClose: false,
        }).then(() => {
          this.IngredientsFlag = true;
          this.Ingredientsbtn = false;// 打印配料表disabled
          // this.getGoodsByNameList();
        }).catch(() => {
          this.Ingredientsbtn = false;
        });
      } else {
        this.CookieTemplateList = JSON.parse(goodsSkuProduction);
        this.cookieStamp();
        // console.log('this.CookieTemplateList',this.CookieTemplateList)
      }
    },
    // 取消上传配料表
    IngredientsResetForm(formName) {
      this.$refs[formName].resetFields();
      this.IngredientsFlag = false;
    },
    IngredientsSubmitForm(formName) {
      this.$refs[formName].validate((valid) => {
        if(valid) {
          getMaterielGoodsPrintingInfo(this.IngredientsForm).then(res => {
            let result = JSON.stringify(res.data.data);
            if( result == '{}') {
              this.IngredientsFlag = true;
              this.Ingredientsbtn = false;// 打印配料表disabled
              this.$message.warning('该商品没有有物料表！');
            } else {
              this.CookieTemplateList = res.data.data;
              this.cookieStamp();
              this.$refs[formName].resetFields();
            }
          })
        } else {
          return false;
        }
      })
    },
    // 打印配料表
    cookieStamp() {
      let formInline = {
        type: 1,
        key: '[1,2]',
        userId: JSON.parse(window.localStorage.getItem("saber-userInfo")).content.account
      }
      query(formInline).then(res => {
        if(res.data.msg == '执行成功') {
          // console.log('res.data.data[0].value',res.data.data.length)
          if(res.data.data.length == 0) {
            this.$message.warning("请到系统模块中的打印机设置中添加打印机");
          } else if (res.data.data.length > 0) {
            res.data.data[0].value = `${res.data.data[0].value}`;
            formInline.value = JSON.parse(res.data.data[0].value);
            formInline.print01 = formInline.value[0];
            formInline.print02 = formInline.value[1];
            console.log('res',formInline.print01);
            setTimeout(() => {
              const LODOP = getLodop()
              if (LODOP) {
                LODOP.PRINT_INIT('') //初始化
                LODOP.SET_PRINT_PAGESIZE(0,'101.3mm',0,'USER')
                LODOP.ADD_PRINT_HTM('1%', '1%', '98%', '98%', document.getElementById('CookieTemplate').innerHTML) //设置打印内容
                // LODOP.SET_PREVIEW_WINDOW(2, 0, 0, 800, 600, 0) //设置预览窗口模式和大小
                // LODOP.PREVIEW()
                // if(LODOP.SET_PRINTER_INDEX("NPI46C2BB(HP LaserJet M1536dnf MFP)")) LODOP.PRINT(); // 增加，需删除
                // if(LODOP.SET_PRINTER_INDEX("POSTEK C168/200s",true)) LODOP.PRINT(); // 增加，需删除
                let printFlag = true;
                CLODOP.On_Return=function(TaskID,value){
                  var stResult = LODOP.GET_VALUE("PRINT_STATUS_ID",value)
                  var stResultText = LODOP.GET_VALUE("PRINT_STATUS_TEXT",value)
                  console.log('value',value,stResult,stResultText)
                  if(value == 1) {
                    printFlag = true;
                  } else {
                    printFlag = false;
                  }
                }
                LODOP.SET_PRINT_MODE(formInline.print01,true);//这个语句设置网络共享打印机
                LODOP.SET_PRINTER_INDEX(formInline.print01,true); // 增加，需删除
                console.log(LODOP.SET_PRINTER_INDEX(formInline.print01));
                if(LODOP.SET_PRINTER_INDEX(formInline.print01)) {
                  // console.log('formInline.print01',formInline.print01);
                  if(printFlag) {
                    LODOP.PRINT(); // 增加，需删除
                    this.$notify({
                      title: '打印成功',
                      message: '请您耐心等待',
                      type: 'success'
                    })
                    setTimeout(() => {
                      this.Ingredientsbtn = false;
                      this.IngredientsFlag = false;
                      this.GoodsByNameList = [];// 配料表搜索数据列表清空
                      this.CookieTemplateList = '';// 打印数据
                    },1000);
                  } else {
                    this.$message.warning('打印失败！');
                    setTimeout(() => {
                      this.Ingredientsbtn = false;
                      this.IngredientsFlag = false;
                      this.GoodsByNameList = [];// 配料表搜索数据列表清空
                      this.CookieTemplateList = '';// 打印数据
                    },500);
                  }
                } else {
                  this.$message.warning('此打印机不存在，请检查电脑是否有此打印机！');
                  setTimeout(() => {
                    this.Ingredientsbtn = false;
                    this.IngredientsFlag = false;
                    this.GoodsByNameList = [];// 配料表搜索数据列表清空
                    this.CookieTemplateList = '';// 打印数据
                  },500);
                }
              }
            },1*1000);
          }
        }
      })
    },
    // 根据物料商品名称模糊查询
    getGoodsByNameList(e) {
      this.IngredientsForm.deptId = this.cityId;
      getMaterielGoodsByName(this.IngredientsForm).then(res => {
        res.data.data.rows.forEach(item => { 
          item.value = item.id;
          item.label = item.name;
          item.children = item.goodsSkuVOS;
          if(item.children.length > 0) {
            item.children.forEach(childitem => {
              childitem.value = childitem.id;
              childitem.label = childitem.specs;
            })
          }
        })
        if(this.IngredientsForm.name == '') {
          this.cascaderFlag = true;
          this.GoodsByNameList = [];
        } else {
          this.cascaderFlag = false;
          this.GoodsByNameList = res.data.data.rows;
        }
      })
    },
    getName(e) {
      // console.log('console.log()',e.target.value);
      this.IngredientsForm.name = e.target.value;
      this.getGoodsByNameList();
    },
    handleChange(value) {
      // console.log(value);
      if(this.IngredientsForm.Ingredientgoods.length > 0 ) {
        this.IngredientsForm.skuId = this.IngredientsForm.Ingredientgoods[1];
      }
    }
  },
}
</script>

<style scoped>
h1,
h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
</style>

<style>
.production-button {
  align-self: center;
}
.production-kindbutton {
  padding: 8px !important;
}
.production-status {
  width: 70px;
  height: 60px;
  border: 3px solid #409EFF;
  border-radius: 50% / 52%;
  color: #409EFF;
  transform:rotate(15deg);
  text-align: center;
  line-height: 60px;
  font-size: 20px;
  font-weight: 550;
  position: absolute;
  right: -4%;
  top: -9%;
}
.checked {
  width: 20px;
  height: 20px;
}
.StorageRecord-abnormal {
  display: flex;
  justify-content: space-around;
  line-height: 3;
}
.StorageRecord-abnormal span {
  width: 25%;
  text-align: center;
}
.StorageRecording-message span {
  color: red;
}
.StorageRecord-title {
  color: #454649;
  font-size: 17px;
}
.deliveryStartTime {
  background: rgb(229, 246, 253);
}
.deliveryBackground {
  background: oldlace;
}
.el-collapse-item__wrap {
  background: rgb(229, 246, 253);
}
.el-collapse {
  border: 0;
  margin-left: 20px;
}
.el-collapse-item__header.is-active {
  background: rgb(229,246,253);
  color: #3a8ee6;
  font-size: 18px;
}
.el-collapse-item__header {
  background: rgb(229,246,253);
  color: #3a8ee6;
  font-size: 18px;
  font-weight: 550;
}
.el-collapse-item__content {
  margin-top: 10px;
  font-size: 15px;
}
#pdf-viewer #content {
  height: 350px!important;
  position: fixed;
  width: 100%;
  z-index: 1;
}
.StorageRecord-titles {
  display: inline-block;
  width: 25%;
  text-align: center;
}
/* ------- 自制折叠面板 -------- */
.arrow {
  display: block;
  width: 10px;
  height: 10px;
  margin-top: 13px;
  border-top: 1px solid #3a8ee6;
  border-right: 1px solid #3a8ee6;
  transform: rotate(45deg);
  /* transition: transform .3s; */
}

.timecolor {
  position: absolute;
  width: 100%;
  line-height: 2;
  display: inline-block;
  font-size: 17px;
  font-weight: 600;
  color: red;
  text-align: right;
  right: 80px;
  top: 20px;
}
/* &:hover {
transform: skewX(10deg) rotateX(12deg); //向前向上
transition: .3s; //过渡时间
transform: scale(1.01); //缩放
} */
</style>
